<template>
  <!--常用菜单-->
  <div class=" col-md-12">
    <div id="customMenuContentDiv" class="module menu-module ">
      <section id="customMenu_titleBar" class="module-header">
        <h1>常用菜单</h1>
        <div class="btn-guroup" role="menuitem" data-toggle="modal" data-target="#sys-set-win">
          <a class="menu-set-icon set-btn" href="#customMenuSetting" onclick="checkedTab(2)" data-toggle="tab" value="list" ></a>
        </div>
      </section>
      <div id="customMenuHome" class="module-content">
        <div v-if="customMenus.status === 'SUCCESS' || customMenus.body.length > 0"
             class="custom-menu-list"
             v-for="item of customMenus.body"
             @click="openTab(
             item.uumsFunction.functionName,
             item.uumsFunction.functionUrl,
             item.uumsFunction.pageEmbedType,
             item.uumsFunction.functionCode,
             item.uumsFunction.sourceSystem,
             item.uumsFunction.parentFunction,
             CUSTOM_MENU_ACCESS)">
          <ul>
            <li class="customMenu_img"><img :src="CUSTOM_MENU_ICON_MAPPING[rootMenuCode(item)] || '/static/resources/img/默认图标.png'"></li>
            <li class="customMenu_name">{{item.uumsFunction.functionName}}</li>
            </ul>
          </div>
      </div>
    </div>
  </div>
</template>

<script>
  import store from '../../store/store'
  import {GET_customMenus} from '../../store/menus/type'
  import {mapActions,mapState} from 'vuex'
    export default {
        name: "custom-menu",
        data(){
          return {
          }
        },
        store,
        computed:{
          ...mapState('menusStore',['customMenus','CUSTOM_MENU_ICON_MAPPING','CUSTOM_MENU_ACCESS'])
        },
        methods:{
          rootMenuCode(uapMenuVo){
            let rootMenuCode = uapMenuVo.rootFunctionCode;
            if (!rootMenuCode && uapMenuVo.customMenu) {
              rootMenuCode = uapMenuVo.customMenu.rootCode;
            }
            return rootMenuCode;
          },
          openTab(functionName,functionUrl,pageEmbedType,functionCode,sourceSystem,parentFunction,accessPath){
            openTab(functionName,functionUrl,pageEmbedType,functionCode,sourceSystem,parentFunction,accessPath);
          }
        }
    }
</script>

<style scoped>

</style>
